// 用户添加
layui.use(['form', 'layer', 'jquery'],
            function () {
                let $ = layui.jquery;
                var form = layui.form;
                layer = layui.layer;

                $('#addBnt').on('click', function (obj) {
                    let p = $("#film_add").serialize();
                    if ($("#userName").val() == '' || $("#password").val() == '' || $("#realName").val() == '') {
                        layer.msg('必填字段不能为空', { offset: 't', icon: 5 });
                        return;
                    }
                    $.ajax({
                        url: 'http://localhost:8080/user/reg',
                        type: 'get',
                        data: p,

                        success: function (vo) {
                            if (vo.code == 401) {
                                layer.msg(vo.message, { offset: 't', icon: 2 });
                            } else if (vo.code == 200) {
                                
                                layer.msg('注册成功', { offset: 't', icon: 6 });
                                setTimeout(function(){
                                    // 关闭当前弹出层
                                    xadmin.close();
                                    // 刷新父窗口
                                    xadmin.father_reload()
                                },1000);

                            }

                        },

                    });
               });
                //时间选择
                layui.use(['form', 'layedit', 'laydate'], function () {
                    var form = layui.form
                        , layer = layui.layer
                        , layedit = layui.layedit
                        , laydate = layui.laydate;
                    //日期
                    laydate.render({
                        elem: '#birthday',
                        theme: '#088A68',
                        trigger: 'click'   //解决闪退问题
                    });
                });
            });